package com.example.Laboratory.Controller;

import com.example.Laboratory.Entity.Achievements_project;
import com.example.Laboratory.Service.Achievements_projectService;
import com.example.Laboratory.Untils.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;

@Api(value = "Achievements_project", description = "科研成果-项目")
@RestController
@RequestMapping(value = "/Achievements_project")
@CrossOrigin
public class Achievements_projectController {

    @Autowired
    Achievements_projectService achievements_projectService;

    @ApiOperation(value = "增加科研-项目表信息", notes = "增加科研-项目表信息")
    @RequestMapping(value = "/addAchievements_patent", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object addAchievements_patent (Achievements_project p) throws IOException {
        return ResultCode.SUCCESS.result(achievements_projectService.addAchievements_project(p));
    }

    @ApiOperation(value = "删除科研-项目表信息", notes = "删除科研-项目表信息")
    @RequestMapping(value = "/deleteAchievements_patent", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    public Object deleteAchievements_patent (@RequestParam int Achievements_project_id) throws IOException {
        return ResultCode.SUCCESS.result(achievements_projectService.deleteAchievements_project(Achievements_project_id));
    }

    @ApiOperation(value = "查找科研-项目表信息", notes = "查找科研-项目表信息")
    @RequestMapping(value = "/researchAchievements_patent", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object researchAchievements_patent ( ) throws IOException {
        return ResultCode.SUCCESS.result(achievements_projectService.researchAchievements_project());
    }

    @ApiOperation(value = "修改科研-项目表信息", notes = "修改科研-项目表信息")
    @RequestMapping(value = "/reviseAchievements_patent", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public Object reviseAchievements_patent (Achievements_project p) throws IOException {
        return ResultCode.SUCCESS.result(achievements_projectService.reviseAchievements_project(p));
    }
}
